package com.jd.finance.core.controller.admin;


import com.jd.finance.core.service.AboutInfoService;
import com.jd.finance.core.service.impl.AdminUtilsServiceImpl;
import com.jd.finance.result.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 关于我们信息表 前端控制器
 * </p>
 *
 * @author LiQingBo
 * @since 2022-05-19
 */
@Api(tags = "关于我们")
@Slf4j
@RestController
@RequestMapping("/admin/core/aboutUsCenter")
public class AdminAboutInfoController {

    @Resource
    private AboutInfoService aboutInfoService;

    @Resource
    private AdminUtilsServiceImpl adminUtilsServiceimpl;

    @ApiOperation("修改关于我们")
    @PostMapping("/updateAppAboutUs")
    public BaseResult updateAppAboutUs(Integer uid, String aboutUs, HttpServletRequest request){
        if(uid == null){
            log.error("uid为空");
            return BaseResult.error().message("uid为空");
        }
        if (!adminUtilsServiceimpl.isInformation(uid)){
            log.error("当前登录用户不是信息管理员账户");
            return BaseResult.error().message("当前登录用户不是信息管理员账户");
        }
        return aboutInfoService.updateAppAboutUs(uid,aboutUs,request);
    }
}

